<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>HexFiend: HFProgressTracker Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">HexFiend
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Instance Methods</a> &#124;
<a href="#properties">Properties</a> &#124;
<a href="interface_h_f_progress_tracker-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">HFProgressTracker Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>A class that helps handle progress indication and cancellation for long running threaded operations.  
 <a href="interface_h_f_progress_tracker.html#details">More...</a></p>
<div class="dynheader">
Inheritance diagram for HFProgressTracker:</div>
<div class="dyncontent">
 <div class="center">
  <img src="interface_h_f_progress_tracker.png" usemap="#HFProgressTracker_map" alt=""/>
  <map id="HFProgressTracker_map" name="HFProgressTracker_map">
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Instance Methods</h2></td></tr>
<tr class="memitem:a5ade4a43db3775d7d3c956b35963fc76"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_h_f_progress_tracker.html#a5ade4a43db3775d7d3c956b35963fc76">beginTrackingProgress</a></td></tr>
<tr class="separator:a5ade4a43db3775d7d3c956b35963fc76"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae94239c895ee93b2bf4e680def6d3eb4"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_h_f_progress_tracker.html#ae94239c895ee93b2bf4e680def6d3eb4">endTrackingProgress</a></td></tr>
<tr class="separator:ae94239c895ee93b2bf4e680def6d3eb4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aba06fdb74247bc38d96224e3de70911f"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_h_f_progress_tracker.html#aba06fdb74247bc38d96224e3de70911f">noteFinished:</a></td></tr>
<tr class="separator:aba06fdb74247bc38d96224e3de70911f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a299c54a607ad4be3be15ab40bd612265"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_h_f_progress_tracker.html#a299c54a607ad4be3be15ab40bd612265">requestCancel:</a></td></tr>
<tr class="separator:a299c54a607ad4be3be15ab40bd612265"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="properties"></a>
Properties</h2></td></tr>
<tr class="memitem:acf443cae934971a56fbf2934f6a3eee2"><td class="memItemLeft" align="right" valign="top">unsigned long long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_h_f_progress_tracker.html#acf443cae934971a56fbf2934f6a3eee2">maxProgress</a></td></tr>
<tr class="separator:acf443cae934971a56fbf2934f6a3eee2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a170fc0d588dc427ffd63a2a33f599315"><td class="memItemLeft" align="right" valign="top">NSDictionary *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_h_f_progress_tracker.html#a170fc0d588dc427ffd63a2a33f599315">userInfo</a></td></tr>
<tr class="separator:a170fc0d588dc427ffd63a2a33f599315"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a33e655d87e0a1fa8a3412c615415ba90"><td class="memItemLeft" align="right" valign="top">NSProgressIndicator *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_h_f_progress_tracker.html#a33e655d87e0a1fa8a3412c615415ba90">progressIndicator</a></td></tr>
<tr class="separator:a33e655d87e0a1fa8a3412c615415ba90"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2f4408dead46aae1142535b312ac381c"><td class="memItemLeft" align="right" valign="top">id&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_h_f_progress_tracker.html#a2f4408dead46aae1142535b312ac381c">delegate</a></td></tr>
<tr class="separator:a2f4408dead46aae1142535b312ac381c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a class="el" href="interface_h_f_progress_tracker.html" title="A class that helps handle progress indication and cancellation for long running threaded operations...">HFProgressTracker</a> is a class that helps handle progress indication and cancellation for long running threaded operations, while imposing minimal overhead. Operations such as Find/Replace or Save take an <a class="el" href="interface_h_f_progress_tracker.html" title="A class that helps handle progress indication and cancellation for long running threaded operations...">HFProgressTracker</a> to provide cancellation and progress reporting.</p>
<p>The thread is expected to write directly into the public currentProgress field (perhaps with atomic functions) as it makes progress. Once beginTrackingProgress is called, the <a class="el" href="interface_h_f_progress_tracker.html" title="A class that helps handle progress indication and cancellation for long running threaded operations...">HFProgressTracker</a> will poll currentProgress until endTrackingProgress is called.</p>
<p>The thread is also expected to read directly from cancelRequested, which is set by the requestCancel method. If requestCancel is set, it should end the operation.</p>
<p>Lastly, the thread is expected to call noteFinished: when it is done, either through cancellation or completing normally.</p>
<p>On the client side, you can set a delegate. progressTracker: didChangeProgressTo: is called on your delegate at regular intervals in the main thread, as the progress changes. Likewise, progressTrackerDidFinish: is called on the main thread after noteFinished: is called.</p>
<p>There is also a progressIndicator property, which if set to an NSProgressIndicator will cause it to be updated regularly. </p>
</div><h2 class="groupheader">Method Documentation</h2>
<a id="a5ade4a43db3775d7d3c956b35963fc76"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5ade4a43db3775d7d3c956b35963fc76">&sect;&nbsp;</a></span>beginTrackingProgress()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (void) beginTrackingProgress </td>
          <td></td>
          <td class="paramname"></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Called to indicate you want to begin tracking the progress, which means that the progress indicator will be updated, and the delegate callbacks may fire. </p>

</div>
</div>
<a id="ae94239c895ee93b2bf4e680def6d3eb4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae94239c895ee93b2bf4e680def6d3eb4">&sect;&nbsp;</a></span>endTrackingProgress()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (void) endTrackingProgress </td>
          <td></td>
          <td class="paramname"></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Called to indicate you want to end tracking progress. The progress indicator will no longer be updated. </p>

</div>
</div>
<a id="aba06fdb74247bc38d96224e3de70911f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aba06fdb74247bc38d96224e3de70911f">&sect;&nbsp;</a></span>noteFinished:()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (void) noteFinished: </td>
          <td></td>
          <td class="paramtype">(id)&#160;</td>
          <td class="paramname"><em>sender</em></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>noteFinished: should be called by the thread when it is done. It is safe to call this from the background thread. </p>

</div>
</div>
<a id="a299c54a607ad4be3be15ab40bd612265"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a299c54a607ad4be3be15ab40bd612265">&sect;&nbsp;</a></span>requestCancel:()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (void) requestCancel: </td>
          <td></td>
          <td class="paramtype">(id)&#160;</td>
          <td class="paramname"><em>sender</em></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>requestCancel: may be called to mark the cancelRequested variable. The thread should poll this variable to determine if it needs to cancel. </p>

</div>
</div>
<h2 class="groupheader">Property Documentation</h2>
<a id="acf443cae934971a56fbf2934f6a3eee2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acf443cae934971a56fbf2934f6a3eee2">&sect;&nbsp;</a></span>maxProgress</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">- (unsigned long long) maxProgress</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">read</span><span class="mlabel">write</span><span class="mlabel">nonatomic</span><span class="mlabel">assign</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p><a class="el" href="interface_h_f_progress_tracker.html" title="A class that helps handle progress indication and cancellation for long running threaded operations...">HFProgressTracker</a> determines the progress as an unsigned long long, but passes the progress to the delegate as a double, which is computed as the current progress divided by the max progress. </p>

</div>
</div>
<a id="a170fc0d588dc427ffd63a2a33f599315"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a170fc0d588dc427ffd63a2a33f599315">&sect;&nbsp;</a></span>userInfo</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">- (NSDictionary*) userInfo</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">read</span><span class="mlabel">write</span><span class="mlabel">nonatomic</span><span class="mlabel">copy</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>The userInfo property is a convenience to allow passing information to the thread. The property is not thread safe - the expectation is that the main thread will set it before the operation starts, and the background thread will read it once after the operation starts. </p>

</div>
</div>
<a id="a33e655d87e0a1fa8a3412c615415ba90"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a33e655d87e0a1fa8a3412c615415ba90">&sect;&nbsp;</a></span>progressIndicator</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">- (NSProgressIndicator*) progressIndicator</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">read</span><span class="mlabel">write</span><span class="mlabel">nonatomic</span><span class="mlabel">strong</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>The progressIndicator property allows an NSProgressIndicator to be associated with the <a class="el" href="interface_h_f_progress_tracker.html" title="A class that helps handle progress indication and cancellation for long running threaded operations...">HFProgressTracker</a>. The progress indicator should have values in the range 0 to 1, and it will be updated with the fraction currentProgress / maxProgress. </p>

</div>
</div>
<a id="a2f4408dead46aae1142535b312ac381c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2f4408dead46aae1142535b312ac381c">&sect;&nbsp;</a></span>delegate</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">- (id) delegate</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">read</span><span class="mlabel">write</span><span class="mlabel">nonatomic</span><span class="mlabel">assign</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Set and get the delegate, which may implement the optional methods below. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="_h_f_progress_tracker_8h_source.html">HFProgressTracker.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.12
</small></address>
</body>
</html>
